package com.huilian.iotbox.admin.dao;

import com.huilian.iotbox.data.dto.AgencyDto;
import com.huilian.iotbox.data.po.Agency;
import com.huilian.iotbox.data.vo.AgencyVo;
import com.huilian.iotbox.data.vo.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

@Mapper
public interface AgencyDao {
    /**
     * 如果不是管理员那么查询有限制
     */
    List<Agency> findAgencyIdAndName(Integer agencyId);

    Agency findOneAgencyById(@Param("id") Integer id);

    List<AgencyVo> findAllByKeyword(AgencyDto agencyDto);

    Integer checkBussAuthNum(String bussAuthNum, UserInfo userInfo, Integer agencyId);

    Integer checkAbbreviation(String alias, Integer id);

    Agency findOneAgencyByUserId(@Param("userId") Integer userId);

    List<Integer> findagencyNoByLevel(int i);

    int insert(AgencyDto agencyDto);

    List<Agency> getAllAgencyOfName(UserInfo userInfo);

    AgencyDto getUserAgencyByUserId(@Param("userId") Integer userId);

    List<Agency> findListByStatus(Integer status);

    /**
     * 根据Set循环查询机构无交易个数
     *
     * @param set
     * @return
     */
    Integer findSetAgencyNoTrade(@Param("set") Set<Integer> set);

    AgencyVo findAgency(@Param("agencyId") Integer agencyId, @Param("userInfo") UserInfo userInfo);

    Integer update(Agency agency);

    List<AgencyVo> findOneAgencyByKeywordOrAgencyId(AgencyDto agencyDto);

    Agency findOneAgencyByParentId(Integer parentId);

    List<AgencyVo> findAgencyByLoginUser(AgencyDto agencyDto);

    List<AgencyVo> findByKeywordByFinanceAgency(AgencyDto agencyDto);

    List<Agency> findByParentId(Integer parentId);


    AgencyVo findDefaultBurningDeviceIdById(@Param("id") Integer id);
}
